Repository navigation
test(test-app): add a sign-in sheet lab for the hosted web auth surface - #4708
Conversation
Present a real ASWebAuthenticationSession sheet from one fixture screen and read it in place. iOS hosts that sheet out of the app's process in com.apple.SafariViewService, so the sheet is the surface regular captures target while the app stays the accessibility primaryApp underneath it. The page comes from a fixture identity provider served over loopback, and it holds fixture values only, so the lane involves no real identity provider and no credential. The committed Maestro flow reads the sheet's own page: its title, and the Email, Password, and LOGIN controls. Driving past that point is left to the manual lane, because on iOS 27.0 the same steps alternate between passing and refusing the capture, which is the intermittency #4593 reports. Three refusals were observed there, all from the iOS snapshot engine's invariants, and the viewport one carries no retriable detail, so the step's own stability re-capture does not poll and the step aborts. Refs: #2449 Refs: #4593
Size Report
Startup median (7 runs, lower is better):
|
|
I found no blocking defect in e551b09, but the PR is not ready to merge until it has live evidence at head. The device run (3/3) was at 7fcb66f. The lane launcher was rewritten after that run, and the new version has only been checked on the host with stub CLIs. Please run 23 of 24 checks pass; the remaining one is a review check, not a test job. There are no conflicts. Could the fixture server run in the lane's own process? If you export The README at line 372 says all three refusals come from Not blocking, and you can take or leave these: the 'build without the module shows unavailable' sentence appears twice in the README section, and one 'That starts X, runs Y' clause is missing its conjunction. The flow YAML, serve script and fixture also carry long narration comments, and trimming them to the constraints code cannot show (such as native submit versus |
|
Follow-up on the CoS review.
Both launcher tests and the fixture app typecheck passed. The exact-head affected gate is queued on the shared validation lock. |
|
This PR is ready at 806f73c. The fixture server now runs inside the lane's own process, so the stdout readiness parsing, the pipe drain and Not blocking, and you can take or leave it: the AbortController and 15 s timeout around 23 of 24 checks pass; the remaining one is a review check, not a test job. The diff touches no production daemon or CLI route. There are no conflicts. |
Apex Sentinel · ✅ Approve · review of
|
| Where | Finding |
|---|---|
examples/test-app/src/screens/AuthSessionLabScreen.tsx:29 |
Canceled sheet is reported as 'error', never 'canceled' (error.name is not the Exception name) |
examples/test-app/src/screens/AuthSessionLabScreen.tsx:19 |
Duplicate openSheet taps leak a live sheet and surface a spurious error status |
1 finding below minor hidden (user_settings.min_severity).
Reviewed with this repository's own Sentinel configuration (894c80ac681c).
💬 Talking to Sentinel
In a finding's thread, reply with:
| Command | What it does |
|---|---|
@apex-sentinel-staging note <context> |
Adds context; Sentinel re-checks the cited code |
@apex-sentinel-staging pivot <why> |
Says the finding is wrong; Sentinel re-checks the cited code |
@apex-sentinel-staging like |
Marks the finding as useful |
@apex-sentinel-staging dislike <why> |
Marks it as not useful, so it is not raised again |
On this conversation, comment @apex-sentinel-staging review to run a full review once again.
There was a problem hiding this comment.
Apex Sentinel: 2 new findings on 806f73c. The verdict and the full list are in the summary comment.
| } catch (error) { | ||
| const canceled = error instanceof Error && error.name === 'AuthSessionCanceled'; | ||
| setStatus(canceled ? 'canceled' : 'error'); | ||
| setMessage(error instanceof Error ? error.message : String(error)); |
There was a problem hiding this comment.
🟡 Minor · Canceled sheet is reported as 'error', never 'canceled' (error.name is not the Exception name)
Dismissing the sheet with Cancel shows status error instead of canceled, so the canceled branch is dead. The JS check reads error.name, but expo-modules-core delivers the Exception(name:description:) name via the code/Code field or a message prefix, not Error.name. This affects every rejection from the module, including AuthSessionAlreadyPresented and InvalidAuthURL, which also land on error.
| } catch (error) { | |
| const canceled = error instanceof Error && error.name === 'AuthSessionCanceled'; | |
| setStatus(canceled ? 'canceled' : 'error'); | |
| setMessage(error instanceof Error ? error.message : String(error)); | |
| } catch (error) { | |
| const code = (error as { code?: string; Code?: string } | null | undefined)?.code ?? | |
| (error as { Code?: string } | null | undefined)?.Code; | |
| const canceled = error instanceof Error && code === 'AuthSessionCanceled'; |
Suggested change
Read the exception name from code or Code (or the message prefix) instead of error.name, or reject with an Exception carrying a code so the name propagates. Then verify on a device by canceling the sheet and asserting auth-session-status reports canceled.
Details
Also raised here
Also raised at this location by persona javascript: Canceled sheet reported as 'error': rejection name read from wrong field — Canceling the sheet (tap the sheet's Cancel, or xcrun simctl dismissal) sets auth-session-status to error instead of the canceled status the type declares, so any lane asserting on canceled never sees it. The native side rejects with Exception(name: "AuthSessionCanceled", description:), and expo-modules-core exposes that name to JavaScript as the rejection's code; error.name stays the default "Error", so the error.name === 'AuthSessionCanceled' test is false for every rejection, including the intentional-cancel case. No sibling screen in this app keys on error.name — AccessorySetupScreen and AutomationLabScreen use only error.message — so nothing here enforces the invariant that the name survives the bridge.
persona: swift-ios, javascript
Useful? Reply @apex-sentinel-staging like, or @apex-sentinel-staging dislike <why> if it is not.
Reply @apex-sentinel-staging note ... to add context, or @apex-sentinel-staging pivot ... if it is wrong — I will re-check the cited code.
| const [message, setMessage] = useState('Ready to open the system sign-in sheet.'); | ||
|
|
||
| async function openSheet() { | ||
| setStatus('presenting'); | ||
| setMessage('Sign-in sheet requested.'); | ||
|
|
||
| try { | ||
| const callbackUrl = await startFixtureSignInSession(AUTH_IDP_DEFAULT_URL); | ||
| setStatus('completed'); | ||
| setMessage(`Signed in: ${callbackUrl}`); | ||
| } catch (error) { | ||
| const canceled = error instanceof Error && error.name === 'AuthSessionCanceled'; | ||
| setStatus(canceled ? 'canceled' : 'error'); | ||
| setMessage(error instanceof Error ? error.message : String(error)); | ||
| } |
There was a problem hiding this comment.
🟡 Minor · Duplicate openSheet taps leak a live sheet and surface a spurious error status
Tapping SIGN IN twice while the first sheet is up sends a second startSignInAsync, which the native controller rejects with AuthSessionAlreadyPresented, and the catch in openSheet sets status to 'error' even though the first sheet is still presenting. The status also never returns to 'idle' after completion, so the only way back to a tappable 'idle' is leaving and re-entering the route. Guard the handler on status === 'presenting' or disable the ActionButton while presenting so a double tap cannot reach the module.
Details
Also raised here
Also raised at this location by persona maintainability: Repeated SIGN IN taps produce an inconsistent final status from two concurrent promises — Pressing the button while status is presenting launches a second openSheet call; the native side rejects the second immediately with AuthSessionAlreadyPresented, setting status to error, but the first promise is still pending. When the sheet eventually closes the first resolution overwrites error with completed, hiding the error from the user. Guard openSheet with an early return when status === 'presenting'.
persona: senior-developer, maintainability
Useful? Reply @apex-sentinel-staging like, or @apex-sentinel-staging dislike <why> if it is not.
Reply @apex-sentinel-staging note ... to add context, or @apex-sentinel-staging pivot ... if it is wrong — I will re-check the cited code.
|
Follow-up for the cancellation and duplicate-tap findings is in #4711. The fixture now reads Expo's typed cancellation code and ignores another tap while a sheet is active. A host probe covers both failures and confirms the sheet can be requested again after cancellation. |
Summary
Adds a test-app fixture for #2449. iOS presents a real
ASWebAuthenticationSessionsheet in SafariViewService. The committed read-only Maestro flow verifies the form controls in place, covering the surface involved in #4593 and #2438.Across 19 files, the PR adds the fixture, flow, and launcher. The launcher starts and closes a loopback provider in its own process. The manual provider serves fixture values with an optional first-request delay.
Validation
e551b09a852760a4c89ccb9ed9b7d6891d7cd0c5and806f73c8c7c3d16214d6aad2faa3435d6c51243e:pnpm test-app:maestro:auth:ios -- --udid <sim>passed once each on iPhone 18 Pro Max, iOS 27.0. Both runs exited 0 and left TCP 4593 without a listener.affected-selectorwith 22 checks unrun. The command-group cancellation test timed out before startup (command-execution.test.ts:34). A standalonepnpm run check:affected:testpassed 93/93 on bothe551b09aand head. The original failure remains unexplained.7fcb66f6: read-only flow passed 3/3. Driving the form produced two snapshot invariant refusals and one XCTest timeout. The reporter's iOS 27.2 remains untested.CI owns Coverage, native builds and device jobs, provider integration, and history-dependent checks. The fixture adds a test-app-build-cache fingerprint. Adding this OAuth lane to iOS CI is a #2449 follow-up.
Refs #2449
Refs #4593
Refs #2438
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.